package com.db.nearcache.remote;

import java.io.IOException;
import java.rmi.Naming;
import java.rmi.NotBoundException;
import java.rmi.RemoteException;

import com.db.nearcache.cache.Cache;
import com.db.nearcache.cache.CacheFactory;

public class RemoteCacheFactory implements CacheFactory {

	private ObservableRemoteCache remoteCache;

	public RemoteCacheFactory(String url) throws IOException, NotBoundException {
		remoteCache = (ObservableRemoteCache) Naming.lookup(url);
	}

	@Override
	public Cache getCache() throws RemoteException {
		return new RemoteCacheAdapter(remoteCache);
	}

}
